/**
 * 
 */
package STUDENTS.TRANNGOCTU.Sources;

import java.util.Scanner;

/**
 * @author lasta
 *
 */
public class Excercise2 {
	public static void main(String[] args) {
		String strExit = "";
		
		do {
			double dNuma,dNumb;
			String strTemp;
			Scanner sc = new Scanner(System.in);
			do {
				System.out.println("Nhap vao a :");
				strTemp = sc.nextLine();
			}while (strTemp.isEmpty());
				 dNuma = Double.parseDouble(strTemp);
			
			do {
				System.out.println("Nhap vao b :");
				strTemp = sc.nextLine();
			}while (strTemp.isEmpty());
				dNumb = Double.parseDouble(strTemp);
			
			do {
				System.out.println("0-cộng.1-trừ .2-nhân .3-chia");
				strTemp = sc.nextLine();
			}while (strTemp.isEmpty()
					||Integer.parseInt(strTemp)<0
					||Integer.parseInt(strTemp)>3);
			byte bOpt = Byte.parseByte(strTemp);
			switch (bOpt) {
			case 0:System.out.println("a + b = " +(dNuma+ dNumb));break;
			case 1:System.out.println("a - b = " +(dNuma-dNumb));break;
			case 2:System.out.println("a * b = " +(dNuma*dNumb));break;
			case 3:if (dNumb != 0)
				System.out.println("a / b = "+(dNuma/dNumb));
			else System.out.println("Khong thuc hien duoc phep tinh");break;
			default://System.out.println("Khong co phep tinh");
				break;	
			}
		}while (strExit.equals("y"));
		
	}
}
